package com.sinosoft.hydra.um.services.component.dataoutput;

import com.sinosoft.hydra.um.services.component.dataoutput.parsers.ColumnParser;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/8/25.
 */
public class RowTemplate<T> {

    List<ColumnTemplate<T>> columnTemplates = new ArrayList<ColumnTemplate<T>>();

    public List<ColumnTemplate<T>> getColumnTemplates() {
        return this.columnTemplates;
    }

    public void setColumnTemplates(List<ColumnTemplate<T>> columnTemplates) {
        this.columnTemplates = columnTemplates;
    }

    public static class ColumnTemplate<T> {

        private String title;
        private ColumnParser<T> columnParser;

        public ColumnTemplate(String title, ColumnParser<T> columnParser) {
            this.title = title;
            this.columnParser = columnParser;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public ColumnParser<T> getColumnParser() {
            return columnParser;
        }

        public void setColumnParser(ColumnParser<T> columnParser) {
            this.columnParser = columnParser;
        }
    }

    public RowTemplate<T> addColumnTemplate(ColumnTemplate<T> columnTemplate) {
        this.columnTemplates.add(columnTemplate);
        return this;
    }
}
